package cn.edu.sdjzu.xg.eagle.xg23_kcsj_01.controller;

import cn.edu.sdjzu.xg.eagle.xg23_kcsj_01.entity.Project;
import cn.edu.sdjzu.xg.eagle.xg23_kcsj_01.service.ProjectService;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;


@RestController
public class ProjectConrtoller {
    @Autowired
    private ProjectService projectService;
    @GetMapping("project")
    public PageInfo<Project> get(int pageNum, int pageSize, Project project) {
        return projectService.get(pageNum,pageSize,project);
    }

    @PostMapping("project")
    public String save(@RequestBody Project project) {
        return projectService.save(project);
    }
    @PutMapping("project")
    public String update(@RequestBody Project project) {
        return projectService.update(project);
    }
    @DeleteMapping("projects/{id}")
    public String delete(@PathVariable int id) {
        return projectService.delete(id);
    }
}